Textbox(autocomplete)
This element is created by setting the type attribute of a textbox to 'autocomplete'. It is used to create a textbox with a popup containing a list of possible completions for what the user has started to type.
The autocomplete functionality is handled through one of more session objects, each of which can return a set of results given the current value of the textbox. The sessions can be set using the searchSessions attribute or by calling the addSession method.
More information about Textbox(autocomplete)
Attributes:
Attributes inherited from textbox
If set to true, the best match will be filled into the textbox as the user types. If false, the default, the value will not be filled in until the user selects an item.
If the label of the textbox is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be placed in place of the cropped text. If the box direction is right to left (rtl), the cropping is reversed.
- start: The text will be cropped on its left side.
- end: The text will be cropped on its right side.
- left: (Deprecated) The text will be cropped on its left side.
- right: (Deprecated) The text will be cropped on its right side.
- center: The text will be cropped on both sides.
- none: The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment.
If true, the autocomplete behavior will be disabled. You might use a script to change this attribute. If false, the default, autocomplete is enabled.
If true, the default value, the popup will be stretched to the width of the textbox. If false, you must set the width of the popup yourself.
If true, the textbox will be filled in with the best match when it loses the focus. If false, it will only be filled in when the user selects an item.
The label that will appear on the textbox. If this is left out, no text appears.
The number of rows to show in the results list at a time. A scrollbar will appear so the user can scroll through the remaining items.
This event handler is called when the textbox is displayed.
This event handler is called when a result is selected for the textbox.
This event handler is called when the user presses Escape to revert the textbox to its original uncompleted value.
If true, the popup is showing. You can change this value to show or hide the popup.
Set to a keyword indicating what type of data to look up for autocomplete. You may set multiple types by separating their names by spaces. The following values are possible, although custom components may be installed which add others.
- history: The user's URL history is searched.
- addrbook: The user's address book is searched.
- ldap: The user's LDAP directories are searched.
If true, a comment column appears in the popup. For the URL history, the comment column will contain the page titles associated with each URL. The default value of this property is false.
If true, the popup will be shown. If false, the popup will not be shown, but the autocomplete results will still be available. You can set this to false and set the autoFill attribute to true to emulate a Communicator 4.x style autocomplete textbox. The default value is true.
If true, the user may cycle through the results list by pressing the TAB key. If false, the default, the TAB key moves the focus to the next element.
Set to the number of milliseconds to wait between when the users presses a key and the results list updates. The default value is 50, which is very fast.
This attribute will be set to the action the user is currently performing. Possible values:
- none: The user is not interacting with the textbox.
- typing: The user is typing into the textbox.
- scrolling: The user is scrolling through the textbox.
Properties and Methods:
Properties and Methods inherited from textbox
Adds a new session object to the autocomplete widget. This can be used to create a customized autocomplete results list. The argument should be an object which implements the nsIAutoCompleteSession interface.
Gets and sets the value of the autoFill attribute.
Gets and sets the value of the autoFillAfterMatch attribute.
Clears the results list.
Gets and sets the value of the crop attribute.
Gets and sets the value of the disableAutocomplete attribute.
Gets and sets the value of the flexPopup attribute.
Gets and sets the value of the focused attribute.
Gets and sets the value of the forceComplete attribute.
Returns the name of the first session with available results.
Returns the result item at the specified index. The item will be a value of type nsIAutoCompleteItem.
Returns the number of results. (The session argument is currently ignored).
Returns the result value at the specified index. The item will correspond to the text of that item that appears in the popup.
Returns the session object with the given index. This will return an object of type nsIAutoCompleteSession.
Returns the session object with the given name. This will return an object of type nsIAutoCompleteSession.
Returns the result item at the specified index for a specific session.
Returns the result value at the specified index for a specific session.
Gets and sets the value of the hideHistory attribute.
This property is set to true while a search is occuring.
This property is set to true during the period while waiting for the timeout between the time when a user has pressed a key and a search is performed.
Gets and sets the value of the label attribute.
Gets and sets the value of the maxrows attribute.
This property will be set to true if the last search resulted in no matches.
Gets and sets the value of the open attribute.
Removes a session object from the autocomplete widget. The argument should be an object which implements the nsIAutoCompleteSession interface.
This property is set to the popup element that displays the results.
Set to a keyword indicating what type of data to look up for autocomplete. You may set multiple types by separating their names by spaces. The following values are possible, although custom components may be installed which add others.
- history: The user's URL history is searched.
- addrbook: The user's address book is searched.
- ldap: The user's LDAP directories are searched.
Gets and sets the value of the showCommentColumn attribute.
Gets and sets the value of the showPopup attribute.
Gets and sets the value of the tabScrolling attribute.
Gets and sets the value of the timeout attribute.
Gets and sets the value of the userAction attribute.